package nc.ui.zzjs.price;

import nc.ui.trade.bsdelegate.BDBusinessDelegator;
import nc.ui.trade.business.HYPubBO_Client;
import nc.vo.pub.CircularlyAccessibleValueObject;
import nc.vo.pub.SuperVO;
import nc.vo.zzjs.price.SettlePriceBVO;
import nc.vo.zzjs.price.SettlePriceGsVO;

public class ClientBusinessDelegator extends BDBusinessDelegator {
	
	public ClientBusinessDelegator() {
		super();
	}
	@Override
	public SuperVO[] queryHeadAllData(Class headClass, String strBillType,
			String strWhere) throws Exception {
		return super.queryHeadAllData(headClass, strBillType, strWhere);
	}

	public nc.vo.pub.CircularlyAccessibleValueObject[] queryBodyAllData(
			Class voClass, String billType, String key, String strWhere)
			throws Exception {
		CircularlyAccessibleValueObject[] vos = null;
		if (billType == null || billType.trim().length() == 0)
			return null;
		else {
			vos = (CircularlyAccessibleValueObject[]) HYPubBO_Client.queryAllBodyData(
					billType, voClass, key, strWhere);
			for(CircularlyAccessibleValueObject vo : vos) {
				String pk = vo.getPrimaryKey();
				SettlePriceGsVO[] bvos =(SettlePriceGsVO[])loadBodyData(pk);
				((SettlePriceBVO)vo).setGrandsonsupervos(bvos);
			}
		}
		return vos;

	}

	public SuperVO[] loadBodyData(String key) throws Exception {
		SuperVO[] supervos =null;
		if (key != null && !"".equals(key)) {
			supervos = HYPubBO_Client.queryByCondition(Class.forName(SettlePriceGsVO.class.getName()), "pk_settleprice_b='"
					+ key + "' and isnull(dr,0)=0");

		}
		return supervos;
	}

}
